﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Web;

namespace WebChatClient.Controllers
{
    public class YahooAccountCreation : IOpenIDAccountCreationStrategy
    {

        public Chatter CreateOpenIDAccount(string Email)
        {
            Chatter acc = new Chatter();
            acc.Nick = Email;
            acc.Password = "Yahoo";
            acc.Status = 1;

            string BasePath = System.AppDomain.CurrentDomain.BaseDirectory.ToString();
            string Imagefolder = @"Content\images\YahooAvatar.png";
            string ImagePath = Path.Combine(BasePath, Imagefolder);
            Image image = Image.FromFile(ImagePath);
            MemoryStream ms = new MemoryStream();
            image.Save(ms, System.Drawing.Imaging.ImageFormat.Png);

            acc.Avatar = ms.ToArray();

            return acc;
        }
    }
}